#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
COLOR_GREEN="\033[0;32m"
COLOR_RED="\033[31m"
ESC="\033[0m"
echo "$COLOR_GREEN [Niva-devtools]Checking TS...$ESC"
yarn run type-checker || echo "$COLOR_RED TS checkfailed, exiting...$ESC" || exit 1

echo "$COLOR_GREEN [Niva-devtools]Checking registry... $ESC"
registry=$(npm config get registry)
if [ $registry == "https://registry.npmjs.org/" ] || [ $registry == "https://registry.npmmirror.com/" ]; then
    exit 0
else 
    echo "$COLOR_RED [Niva-devtools]Registry is not npm or taobao, exiting... $ESC"
    exit 1
fi